{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-09-18T07:59:19.291790Z",
     "start_time": "2025-09-18T07:59:19.277667Z"
    }
   },
   "source": [
    "import numpy as np\n",
    "import os\n",
    "import pandas as pd\n",
    "from sqlalchemy import column"
   ],
   "outputs": [],
   "execution_count": 32
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T07:59:25.013127Z",
     "start_time": "2025-09-18T07:59:21.037583Z"
    }
   },
   "cell_type": "code",
   "source": [
    "client = pd.read_pickle('../data/outdata/client_full.pkl')\n",
    "targets = pd.read_pickle('../data/outdata/targets_full.pkl')\n",
    "trx = pd.read_pickle('../data/outdata/trx_full.pkl')"
   ],
   "id": "7aeebf410d070fa6",
   "outputs": [],
   "execution_count": 33
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T07:59:29.012837Z",
     "start_time": "2025-09-18T07:59:28.998139Z"
    }
   },
   "cell_type": "code",
   "source": "client.shape, targets.shape, trx.shape",
   "id": "5a1fb408186f2ded",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((100224, 1), (1202688, 8), (98721, 14))"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 34
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T07:59:30.522004Z",
     "start_time": "2025-09-18T07:59:30.308268Z"
    }
   },
   "cell_type": "code",
   "source": "client['client_id'].unique().shape, targets['client_id'].unique().shape, trx['client_id'].unique().shape",
   "id": "579a4814956ef826",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((100224,), (100224,), (98721,))"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 35
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T07:59:32.346197Z",
     "start_time": "2025-09-18T07:59:31.762793Z"
    }
   },
   "cell_type": "code",
   "source": [
    "trx_targets = pd.merge(left=trx, right=targets, how='inner', on='client_id')\n",
    "trx_targets.shape"
   ],
   "id": "baba1006836c8c04",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1184652, 21)"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 36
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T07:59:34.373646Z",
     "start_time": "2025-09-18T07:59:34.359063Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets.columns",
   "id": "513d4a8afe7a63ea",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['client_id', 'event_time', 'amount', 'event_type', 'event_subtype',\n",
       "       'currency', 'src_type11', 'src_type12', 'dst_type11', 'dst_type12',\n",
       "       'src_type21', 'src_type22', 'src_type31', 'src_type32', 'mon',\n",
       "       'target_1', 'target_2', 'target_3', 'target_4', 'trans_count',\n",
       "       'diff_trans_date'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 37
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T07:59:46.227467Z",
     "start_time": "2025-09-18T07:59:46.106363Z"
    }
   },
   "cell_type": "code",
   "source": [
    "trx_targets.drop(columns=['event_type', 'currency', 'src_type11', 'src_type12', 'dst_type11', 'dst_type12',\n",
    "       'src_type21', 'src_type22', 'src_type31', 'src_type32', 'trans_count',\n",
    "       'diff_trans_date', \"amount\"],inplace=True)"
   ],
   "id": "2b02d62d5e88731e",
   "outputs": [],
   "execution_count": 38
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T07:59:48.143879Z",
     "start_time": "2025-09-18T07:59:47.964674Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets.client_id.nunique()",
   "id": "e3c64dfaefeb27f3",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "98721"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 39
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T07:59:50.332264Z",
     "start_time": "2025-09-18T07:59:50.318466Z"
    }
   },
   "cell_type": "code",
   "source": [
    "def trans_date_to_timestamp(date):\n",
    "    from datetime import datetime\n",
    "    dt = datetime.strptime(date, \"%Y-%m-%d\")\n",
    "    timestamp = dt.timestamp()\n",
    "    return int(timestamp)"
   ],
   "id": "116ae4ce133ea634",
   "outputs": [],
   "execution_count": 40
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:00:00.667929Z",
     "start_time": "2025-09-18T07:59:52.366641Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets.mon = trx_targets.mon.apply(trans_date_to_timestamp)",
   "id": "68f7603a5dd1695a",
   "outputs": [],
   "execution_count": 41
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:00:02.712231Z",
     "start_time": "2025-09-18T08:00:02.686660Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets",
   "id": "a6a533eed4efa5e9",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "                                                 client_id  \\\n",
       "0        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "1        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "2        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "3        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "4        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "...                                                    ...   \n",
       "1184647  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184648  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184649  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184650  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184651  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "\n",
       "                                                event_time  \\\n",
       "0         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "1         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "2         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "3         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "4         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "...                                                    ...   \n",
       "1184647  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184648  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184649  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184650  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184651  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "\n",
       "                                             event_subtype         mon  \\\n",
       "0                                             [1, 1, 1, 1]  1645977600   \n",
       "1                                             [1, 1, 1, 1]  1648656000   \n",
       "2                                             [1, 1, 1, 1]  1651248000   \n",
       "3                                             [1, 1, 1, 1]  1653926400   \n",
       "4                                             [1, 1, 1, 1]  1656518400   \n",
       "...                                                    ...         ...   \n",
       "1184647  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1664467200   \n",
       "1184648  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1667145600   \n",
       "1184649  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1669737600   \n",
       "1184650  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1672416000   \n",
       "1184651  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1675094400   \n",
       "\n",
       "         target_1  target_2  target_3  target_4  \n",
       "0               0         0         0         0  \n",
       "1               0         0         0         0  \n",
       "2               0         0         0         0  \n",
       "3               0         0         0         0  \n",
       "4               0         0         0         0  \n",
       "...           ...       ...       ...       ...  \n",
       "1184647         0         0         0         0  \n",
       "1184648         0         0         0         0  \n",
       "1184649         0         0         0         0  \n",
       "1184650         0         0         0         0  \n",
       "1184651         0         0         0         0  \n",
       "\n",
       "[1184652 rows x 8 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>client_id</th>\n",
       "      <th>event_time</th>\n",
       "      <th>event_subtype</th>\n",
       "      <th>mon</th>\n",
       "      <th>target_1</th>\n",
       "      <th>target_2</th>\n",
       "      <th>target_3</th>\n",
       "      <th>target_4</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1645977600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1648656000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1651248000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1653926400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1656518400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184647</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1664467200</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184648</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1667145600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184649</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1669737600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184650</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1672416000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184651</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1675094400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1184652 rows × 8 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 42
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:00:25.226119Z",
     "start_time": "2025-09-18T08:00:07.544401Z"
    }
   },
   "cell_type": "code",
   "source": [
    "trx_targets[\"mon_index\"] = trx_targets.apply(\n",
    "    lambda row:-1 if len(np.where(row[\"event_time\"]>row[\"mon\"])[0])==0\n",
    "                    else np.where(row[\"event_time\"]>row[\"mon\"])[0][0],\n",
    "                                             axis=1)"
   ],
   "id": "c1d280b14ec24c09",
   "outputs": [],
   "execution_count": 43
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:00:36.456770Z",
     "start_time": "2025-09-18T08:00:27.997595Z"
    }
   },
   "cell_type": "code",
   "source": [
    "trx_targets[\"mon_left_len\"]=trx_targets.apply(\n",
    "    lambda row:len(row[\"event_time\"])-row[\"mon_index\"],\n",
    "    axis=1)\n",
    "trx_targets[\"len\"]=trx_targets.event_time.apply(len)"
   ],
   "id": "71d1a270736f12aa",
   "outputs": [],
   "execution_count": 44
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:00:37.770958Z",
     "start_time": "2025-09-18T08:00:37.740929Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets",
   "id": "e6cf25a67e477819",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "                                                 client_id  \\\n",
       "0        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "1        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "2        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "3        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "4        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "...                                                    ...   \n",
       "1184647  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184648  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184649  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184650  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184651  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "\n",
       "                                                event_time  \\\n",
       "0         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "1         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "2         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "3         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "4         [1634136341, 1638718103, 1663377587, 1667825293]   \n",
       "...                                                    ...   \n",
       "1184647  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184648  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184649  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184650  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184651  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "\n",
       "                                             event_subtype         mon  \\\n",
       "0                                             [1, 1, 1, 1]  1645977600   \n",
       "1                                             [1, 1, 1, 1]  1648656000   \n",
       "2                                             [1, 1, 1, 1]  1651248000   \n",
       "3                                             [1, 1, 1, 1]  1653926400   \n",
       "4                                             [1, 1, 1, 1]  1656518400   \n",
       "...                                                    ...         ...   \n",
       "1184647  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1664467200   \n",
       "1184648  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1667145600   \n",
       "1184649  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1669737600   \n",
       "1184650  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1672416000   \n",
       "1184651  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1675094400   \n",
       "\n",
       "         target_1  target_2  target_3  target_4  mon_index  mon_left_len  len  \n",
       "0               0         0         0         0          2             2    4  \n",
       "1               0         0         0         0          2             2    4  \n",
       "2               0         0         0         0          2             2    4  \n",
       "3               0         0         0         0          2             2    4  \n",
       "4               0         0         0         0          2             2    4  \n",
       "...           ...       ...       ...       ...        ...           ...  ...  \n",
       "1184647         0         0         0         0        216            29  245  \n",
       "1184648         0         0         0         0        223            22  245  \n",
       "1184649         0         0         0         0        234            11  245  \n",
       "1184650         0         0         0         0         -1           246  245  \n",
       "1184651         0         0         0         0         -1           246  245  \n",
       "\n",
       "[1184652 rows x 11 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>client_id</th>\n",
       "      <th>event_time</th>\n",
       "      <th>event_subtype</th>\n",
       "      <th>mon</th>\n",
       "      <th>target_1</th>\n",
       "      <th>target_2</th>\n",
       "      <th>target_3</th>\n",
       "      <th>target_4</th>\n",
       "      <th>mon_index</th>\n",
       "      <th>mon_left_len</th>\n",
       "      <th>len</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1645977600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1648656000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1651248000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1653926400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103, 1663377587, 1667825293]</td>\n",
       "      <td>[1, 1, 1, 1]</td>\n",
       "      <td>1656518400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184647</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1664467200</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>216</td>\n",
       "      <td>29</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184648</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1667145600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>223</td>\n",
       "      <td>22</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184649</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1669737600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>234</td>\n",
       "      <td>11</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184650</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1672416000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-1</td>\n",
       "      <td>246</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184651</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1675094400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-1</td>\n",
       "      <td>246</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1184652 rows × 11 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 45
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:00:42.990464Z",
     "start_time": "2025-09-18T08:00:42.976142Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets.columns",
   "id": "7145167caf66003c",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['client_id', 'event_time', 'event_subtype', 'mon', 'target_1',\n",
       "       'target_2', 'target_3', 'target_4', 'mon_index', 'mon_left_len', 'len'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 46
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:00:44.839143Z",
     "start_time": "2025-09-18T08:00:44.819635Z"
    }
   },
   "cell_type": "code",
   "source": [
    "def truncate_events(row, col):\n",
    "    idx = row[\"mon_index\"]\n",
    "    if idx == -1:\n",
    "        return row[col]\n",
    "    else:\n",
    "        return row[col][:idx]"
   ],
   "id": "380bfff087fd4340",
   "outputs": [],
   "execution_count": 47
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:01:03.296552Z",
     "start_time": "2025-09-18T08:00:46.701263Z"
    }
   },
   "cell_type": "code",
   "source": [
    "for col in ['event_time', 'event_subtype']:\n",
    "    trx_targets[col] = trx_targets.apply(\n",
    "        lambda row: truncate_events(row, col),\n",
    "        axis=1)"
   ],
   "id": "53aef939cf790799",
   "outputs": [],
   "execution_count": 48
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:01:05.918107Z",
     "start_time": "2025-09-18T08:01:05.887119Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets",
   "id": "150776579210cf8e",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "                                                 client_id  \\\n",
       "0        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "1        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "2        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "3        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "4        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "...                                                    ...   \n",
       "1184647  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184648  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184649  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184650  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184651  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "\n",
       "                                                event_time  \\\n",
       "0                                 [1634136341, 1638718103]   \n",
       "1                                 [1634136341, 1638718103]   \n",
       "2                                 [1634136341, 1638718103]   \n",
       "3                                 [1634136341, 1638718103]   \n",
       "4                                 [1634136341, 1638718103]   \n",
       "...                                                    ...   \n",
       "1184647  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184648  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184649  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184650  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184651  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "\n",
       "                                             event_subtype         mon  \\\n",
       "0                                                   [1, 1]  1645977600   \n",
       "1                                                   [1, 1]  1648656000   \n",
       "2                                                   [1, 1]  1651248000   \n",
       "3                                                   [1, 1]  1653926400   \n",
       "4                                                   [1, 1]  1656518400   \n",
       "...                                                    ...         ...   \n",
       "1184647  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1664467200   \n",
       "1184648  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1667145600   \n",
       "1184649  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1669737600   \n",
       "1184650  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1672416000   \n",
       "1184651  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1675094400   \n",
       "\n",
       "         target_1  target_2  target_3  target_4  mon_index  mon_left_len  len  \n",
       "0               0         0         0         0          2             2    4  \n",
       "1               0         0         0         0          2             2    4  \n",
       "2               0         0         0         0          2             2    4  \n",
       "3               0         0         0         0          2             2    4  \n",
       "4               0         0         0         0          2             2    4  \n",
       "...           ...       ...       ...       ...        ...           ...  ...  \n",
       "1184647         0         0         0         0        216            29  245  \n",
       "1184648         0         0         0         0        223            22  245  \n",
       "1184649         0         0         0         0        234            11  245  \n",
       "1184650         0         0         0         0         -1           246  245  \n",
       "1184651         0         0         0         0         -1           246  245  \n",
       "\n",
       "[1184652 rows x 11 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>client_id</th>\n",
       "      <th>event_time</th>\n",
       "      <th>event_subtype</th>\n",
       "      <th>mon</th>\n",
       "      <th>target_1</th>\n",
       "      <th>target_2</th>\n",
       "      <th>target_3</th>\n",
       "      <th>target_4</th>\n",
       "      <th>mon_index</th>\n",
       "      <th>mon_left_len</th>\n",
       "      <th>len</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1645977600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1648656000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1651248000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1653926400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1656518400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184647</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1664467200</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>216</td>\n",
       "      <td>29</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184648</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1667145600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>223</td>\n",
       "      <td>22</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184649</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1669737600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>234</td>\n",
       "      <td>11</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184650</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1672416000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-1</td>\n",
       "      <td>246</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184651</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1675094400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-1</td>\n",
       "      <td>246</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1184652 rows × 11 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 49
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:01:13.631246Z",
     "start_time": "2025-09-18T08:01:13.483945Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets.drop(columns=['mon_index', 'mon_left_len', 'len'], inplace=True)",
   "id": "13945b5e21a5f3ab",
   "outputs": [],
   "execution_count": 50
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:01:16.803157Z",
     "start_time": "2025-09-18T08:01:16.447274Z"
    }
   },
   "cell_type": "code",
   "source": [
    "trx_targets['len'] = trx_targets['event_subtype'].apply(len)\n",
    "trx_targets"
   ],
   "id": "271bac86cc2d1214",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "                                                 client_id  \\\n",
       "0        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "1        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "2        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "3        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "4        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "...                                                    ...   \n",
       "1184647  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184648  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184649  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184650  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1184651  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "\n",
       "                                                event_time  \\\n",
       "0                                 [1634136341, 1638718103]   \n",
       "1                                 [1634136341, 1638718103]   \n",
       "2                                 [1634136341, 1638718103]   \n",
       "3                                 [1634136341, 1638718103]   \n",
       "4                                 [1634136341, 1638718103]   \n",
       "...                                                    ...   \n",
       "1184647  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184648  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184649  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184650  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1184651  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "\n",
       "                                             event_subtype         mon  \\\n",
       "0                                                   [1, 1]  1645977600   \n",
       "1                                                   [1, 1]  1648656000   \n",
       "2                                                   [1, 1]  1651248000   \n",
       "3                                                   [1, 1]  1653926400   \n",
       "4                                                   [1, 1]  1656518400   \n",
       "...                                                    ...         ...   \n",
       "1184647  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1664467200   \n",
       "1184648  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1667145600   \n",
       "1184649  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1669737600   \n",
       "1184650  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1672416000   \n",
       "1184651  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1675094400   \n",
       "\n",
       "         target_1  target_2  target_3  target_4  len  \n",
       "0               0         0         0         0    2  \n",
       "1               0         0         0         0    2  \n",
       "2               0         0         0         0    2  \n",
       "3               0         0         0         0    2  \n",
       "4               0         0         0         0    2  \n",
       "...           ...       ...       ...       ...  ...  \n",
       "1184647         0         0         0         0  216  \n",
       "1184648         0         0         0         0  223  \n",
       "1184649         0         0         0         0  234  \n",
       "1184650         0         0         0         0  245  \n",
       "1184651         0         0         0         0  245  \n",
       "\n",
       "[1184652 rows x 9 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>client_id</th>\n",
       "      <th>event_time</th>\n",
       "      <th>event_subtype</th>\n",
       "      <th>mon</th>\n",
       "      <th>target_1</th>\n",
       "      <th>target_2</th>\n",
       "      <th>target_3</th>\n",
       "      <th>target_4</th>\n",
       "      <th>len</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1645977600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1648656000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1651248000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1653926400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1656518400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184647</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1664467200</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>216</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184648</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1667145600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>223</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184649</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1669737600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>234</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184650</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1672416000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184651</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1675094400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1184652 rows × 9 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 51
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:06:05.973376Z",
     "start_time": "2025-09-18T08:06:05.491188Z"
    }
   },
   "cell_type": "code",
   "source": [
    "trx_targets_without_nan = trx_targets.loc[(trx_targets['len'] > 0), :].drop(columns=['len']).reset_index(drop=True)\n",
    "trx_targets_without_nan"
   ],
   "id": "a58bb9b0ff635049",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "                                                 client_id  \\\n",
       "0        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "1        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "2        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "3        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "4        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "...                                                    ...   \n",
       "1125338  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1125339  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1125340  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1125341  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1125342  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "\n",
       "                                                event_time  \\\n",
       "0                                 [1634136341, 1638718103]   \n",
       "1                                 [1634136341, 1638718103]   \n",
       "2                                 [1634136341, 1638718103]   \n",
       "3                                 [1634136341, 1638718103]   \n",
       "4                                 [1634136341, 1638718103]   \n",
       "...                                                    ...   \n",
       "1125338  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1125339  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1125340  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1125341  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1125342  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "\n",
       "                                             event_subtype         mon  \\\n",
       "0                                                   [1, 1]  1645977600   \n",
       "1                                                   [1, 1]  1648656000   \n",
       "2                                                   [1, 1]  1651248000   \n",
       "3                                                   [1, 1]  1653926400   \n",
       "4                                                   [1, 1]  1656518400   \n",
       "...                                                    ...         ...   \n",
       "1125338  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1664467200   \n",
       "1125339  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1667145600   \n",
       "1125340  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1669737600   \n",
       "1125341  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1672416000   \n",
       "1125342  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1675094400   \n",
       "\n",
       "         target_1  target_2  target_3  target_4  \n",
       "0               0         0         0         0  \n",
       "1               0         0         0         0  \n",
       "2               0         0         0         0  \n",
       "3               0         0         0         0  \n",
       "4               0         0         0         0  \n",
       "...           ...       ...       ...       ...  \n",
       "1125338         0         0         0         0  \n",
       "1125339         0         0         0         0  \n",
       "1125340         0         0         0         0  \n",
       "1125341         0         0         0         0  \n",
       "1125342         0         0         0         0  \n",
       "\n",
       "[1125343 rows x 8 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>client_id</th>\n",
       "      <th>event_time</th>\n",
       "      <th>event_subtype</th>\n",
       "      <th>mon</th>\n",
       "      <th>target_1</th>\n",
       "      <th>target_2</th>\n",
       "      <th>target_3</th>\n",
       "      <th>target_4</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1645977600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1648656000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1651248000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1653926400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1656518400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125338</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1664467200</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125339</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1667145600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125340</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1669737600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125341</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1672416000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125342</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1675094400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1125343 rows × 8 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 52
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:28:48.819402Z",
     "start_time": "2025-09-18T08:28:40.867765Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets_without_nan[\"client_id\"] = trx_targets_without_nan.apply(lambda row:\"_\".join([row[\"client_id\"],str(row[\"mon\"])]),axis=1)",
   "id": "bfef12aa1c595392",
   "outputs": [],
   "execution_count": 53
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:28:55.281711Z",
     "start_time": "2025-09-18T08:28:55.251832Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets_without_nan",
   "id": "8db1de2924e7ec6",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "                                                 client_id  \\\n",
       "0        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "1        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "2        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "3        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "4        06d777b861a65be029fd03851af46fb9c3ef4391714436...   \n",
       "...                                                    ...   \n",
       "1125338  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1125339  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1125340  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1125341  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "1125342  fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...   \n",
       "\n",
       "                                                event_time  \\\n",
       "0                                 [1634136341, 1638718103]   \n",
       "1                                 [1634136341, 1638718103]   \n",
       "2                                 [1634136341, 1638718103]   \n",
       "3                                 [1634136341, 1638718103]   \n",
       "4                                 [1634136341, 1638718103]   \n",
       "...                                                    ...   \n",
       "1125338  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1125339  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1125340  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1125341  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "1125342  [1609660447, 1610090831, 1611184783, 161136355...   \n",
       "\n",
       "                                             event_subtype         mon  \\\n",
       "0                                                   [1, 1]  1645977600   \n",
       "1                                                   [1, 1]  1648656000   \n",
       "2                                                   [1, 1]  1651248000   \n",
       "3                                                   [1, 1]  1653926400   \n",
       "4                                                   [1, 1]  1656518400   \n",
       "...                                                    ...         ...   \n",
       "1125338  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1664467200   \n",
       "1125339  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1667145600   \n",
       "1125340  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1669737600   \n",
       "1125341  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1672416000   \n",
       "1125342  [7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...  1675094400   \n",
       "\n",
       "         target_1  target_2  target_3  target_4  \n",
       "0               0         0         0         0  \n",
       "1               0         0         0         0  \n",
       "2               0         0         0         0  \n",
       "3               0         0         0         0  \n",
       "4               0         0         0         0  \n",
       "...           ...       ...       ...       ...  \n",
       "1125338         0         0         0         0  \n",
       "1125339         0         0         0         0  \n",
       "1125340         0         0         0         0  \n",
       "1125341         0         0         0         0  \n",
       "1125342         0         0         0         0  \n",
       "\n",
       "[1125343 rows x 8 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>client_id</th>\n",
       "      <th>event_time</th>\n",
       "      <th>event_subtype</th>\n",
       "      <th>mon</th>\n",
       "      <th>target_1</th>\n",
       "      <th>target_2</th>\n",
       "      <th>target_3</th>\n",
       "      <th>target_4</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1645977600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1648656000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1651248000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1653926400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>06d777b861a65be029fd03851af46fb9c3ef4391714436...</td>\n",
       "      <td>[1634136341, 1638718103]</td>\n",
       "      <td>[1, 1]</td>\n",
       "      <td>1656518400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125338</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1664467200</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125339</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1667145600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125340</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1669737600</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125341</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1672416000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125342</th>\n",
       "      <td>fff885cf797bf5e8f79c8319e2b512f08875105ba2105e...</td>\n",
       "      <td>[1609660447, 1610090831, 1611184783, 161136355...</td>\n",
       "      <td>[7, 7, 10, 3, 1, 3, 11, 7, 3, 12, 43, 1, 3, 10...</td>\n",
       "      <td>1675094400</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1125343 rows × 8 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 54
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:29:21.982888Z",
     "start_time": "2025-09-18T08:29:21.508438Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets_without_nan.client_id.nunique()",
   "id": "2d3b90c05a7451ef",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1125343"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 55
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-09-18T08:33:56.840330Z",
     "start_time": "2025-09-18T08:33:42.540855Z"
    }
   },
   "cell_type": "code",
   "source": "trx_targets_without_nan.reset_index(drop=True).to_pickle(\"../data/dataset/trx_time_targets.pkl\")",
   "id": "fe5b06d2884e6987",
   "outputs": [],
   "execution_count": 57
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
